<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>37 子类对父类方法的重写</title>
</head>

<body>
    <script>
        class Phone {
            constructor(brand, price) {
                this.brand = brand;
                this.price = price;
            }

            call() {
                console.log('I can call');
            }
        }

        class SmartPhone extends Phone {
            constructor(brand, price, color, size) {
                super(brand, price);
                this.color = color;
                this.size = size;
            }

            photo() {
                console.log('I can photo');
            }

            play() {
                console.log('I can play game');
            }

            call() {
                console.log('I can video call');
            }
        }

        const mi = new SmartPhone('mi', 799, 'RED', 4.7);
        console.log(mi);
        mi.call();
        mi.photo();
        mi.play();
    </script>
</body>

</html>